home *** CD-ROM | disk | FTP | other *** search
- /*---------------------------------------------------------------------------
- | This program demonstrates some of the functions in MSCHRT V2.00 |
- | |
- | (c) 1988 Ryle Design, P.O. Box 22, Mt. Pleasant, Michigan 48804 |
- ---------------------------------------------------------------------------*/
-
-
- #include <stdio.h>
- #include <conio.h>
- #include <math.h>
-
- #include "mschrt.h"
-
-
- void sin_funct(void)
- /*---------------------------------------------------------------------------
- | A simple function to time. MSCHRT will tell us how many times this |
- | function was called and how much time we spent here. |
- | |
- | Globals referenced: none |
- | |
- | Arguments: void |
- | |
- | Returns: void |
- ---------------------------------------------------------------------------*/
- {
- double alpha;
-
- t_entry(2); /* start timer 2 */
-
- alpha = sin(2.2734593); /* do something */
-
- t_exit(2); /* stop timer 2 */
-
- } /* sin_funct */
-
-
-
- void main(void)
- {
- long unsigned hits, elapsed;
- int indx;
-
- t_start(); /* init MSCHRT first thing */
- t_entry(0); /* we use timer 0 to time whole run */
-
- printf("MSCHRT V2.00 Demonstration\n\n");
-
- printf("Press any key >> ");
-
- t_entry(1); /* time getch() with timer 1 */
- getch();
- t_exit(1);
-
- t_ask_timer(1,&hits,&elapsed); /* get timer 1 results */
-
- printf("\nResponse time was %lu microseconds, or %f seconds\n",elapsed,elapsed/1000000.0);
-
- printf("\nCalling sin function with embedded timer 100 times ... ");
- for (indx=0; indx<100; indx++) sin_funct();
- printf("complete\n\n");
-
- t_exit(0); /* stop timer timing total run time */
- t_stop(); /* shut down MSCHRT primitives */
-
- t_rname("MSCHRT Demonstration"); /* report title */
- t_name(0,"Total run time"); /* give each timer a name */
- t_name(1,"getch() response");
- t_name(2,"sin() function");
-
- t_report(0); /* do report - (0) goes to CRT */
-
- printf("\nDemo complete\n"); /* all done ... */
-
- } /* main */
-
-